﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Attendance : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = "我的休假详情";
        scjrm.WebServiceGZ Web = new scjrm.WebServiceGZ();
        if (Session["UID"] != null)
        {

            string UID = Session["UID"].ToString();
            string YGBH = Session["ygbh"].ToString();
            string XINGMING = Session["xingming"].ToString();
            string ZJM = Session["zjm"].ToString();
            string KL = Session["kl"].ToString();
            if (KL == "202CB962AC59075B964B07152D234B70")
            {
                Response.Redirect("Repass.aspx");
            }
            DataSet dsMonth = Web.GetInfoMonth(0,100,YGBH);
            if (dsMonth != null)
            {
                if (!IsPostBack)
                {
                    //显示记录集的记录
                    DropDownList1.DataSource = dsMonth.Tables[0].DefaultView;//指定DropDownList使用的表里的那些字段
                    DropDownList1.DataTextField = "月份"; //dropdownlist的Text的字段
                    DropDownList1.DataValueField = "月份";//dropdownlist的Value的字段
                    DropDownList1.DataBind();
                    //DropDownList1.SelectedIndex = ;

                    DropDownList2.DataSource = dsMonth.Tables[0].DefaultView;//指定DropDownList使用的表里的那些字段
                    DropDownList2.DataTextField = "月份"; //dropdownlist的Text的字段
                    DropDownList2.DataValueField = "月份";//dropdownlist的Value的字段
                    DropDownList2.DataBind();
                }
            }
            else
            {
                this.Response.Write("加载数据错误!");
            }

            DataSet dsinfouser = Web.GetInfoUserName("shensoft", YGBH);
            if (dsinfouser != null)
            {
                if (!IsPostBack)
                {
                    //显示记录集的记录
                    DropDownList0.DataSource = dsinfouser.Tables[0].DefaultView;//指定DropDownList使用的表里的那些字段
                    DropDownList0.DataTextField = "xingming"; //dropdownlist的Text的字段
                    DropDownList0.DataValueField = "ygbh";//dropdownlist的Value的字段
                    DropDownList0.DataBind();
                    DropDownList0.SelectedValue = YGBH;
                }
            }
            else
            {
                this.Response.Write("加载数据错误!");
            }

        }
        else
        {
            Session.Abandon();
            //清空
            Session.Clear();
            Response.Redirect("Login.aspx");
        }
    }
    protected void DropDownList0_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void submit_Click(object sender, EventArgs e)
    {
        string YGBH = DropDownList0.SelectedItem.Value;
        string srq = DropDownList1.SelectedItem.Text;
        string erq = DropDownList2.SelectedItem.Text;

        scjrm.WebServiceGZ Web = new scjrm.WebServiceGZ();

        //string GetAttInfoEx = "";
        DataSet GetAttInfo = Web.GetUserAttInfo("shensoft",YGBH,srq,erq);
        /**
        for (int w = 0; w < GetAttInfo.Tables[0].Rows.Count; w++)
        {
            GetAttInfoEx += "<li>\r\n" +
                "    <dl>\r\n" +
                "        <dt>" + GetAttInfo.Tables[0].Rows[w][0].ToString() + "</dt>" +
                "        <dd>" + GetAttInfo.Tables[0].Rows[w][1].ToString() + "</dd>\r\n" +
                "        <dd>" + GetAttInfo.Tables[0].Rows[w][2].ToString() + "</dd>\r\n" +
                "        <dd>" + GetAttInfo.Tables[0].Rows[w][3].ToString() + "</dd>\r\n" +
                "        <dd>" + GetAttInfo.Tables[0].Rows[w][4].ToString() + "</dd>\r\n" +
                "    </dl>\r\n" +
                "</li>\r\n";
        }

        this.GetAttInfo.Text = GetAttInfoEx;
         **/
        GridView1.DataSource = GetAttInfo;
        GridView1.DataKeyNames = new string[] { "rqtime" };//主键  
        GridView1.DataBind(); 

     
    }
}
